package com.zzh.demo.controller;

import com.zzh.demo.dao.StudentMapperExt;
import com.zzh.demo.model.Student;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Random;

/**
 * description: <br>
 * createTime: 2018/12/116:56 <br>
 *
 * @author zzh
 */
@RestController
public class DemoController {

    @Resource
    StudentMapperExt studentMapper;


    public DemoController() {
        System.out.println("DemoController");
    }


    @RequestMapping("demo")
    public Object demo() {
        return studentMapper.selectByPrimaryKey("01");
    }

    @RequestMapping("demo1")
    public Object demo1() {
        Student student = new Student();
        student.setSid("" + new Random().nextInt());
        student.setSage(new Date());
        student.setSname("张三");
        student.setSsex("男");
        return studentMapper.insert(student);
    }
}
